define(["durandal/app", "durandal/system", "knockout"], function(
  app,
  system,
  ko
) {
  function LifeCycle() {
    this.name = "A";
    this.list = ko.observableArray([]);
  }

  LifeCycle.prototype.activate = function() {
    system.log("Lifecycle : activate : hello");
    this.list.push(this.name + ":activate:" + new Date().getTime());
  };

  LifeCycle.prototype.binding = function() {
    system.log("Lifecycle : binding : hello");
    this.list.push(this.name + ":binding:" + new Date().getTime());
    return { cacheViews: true }; //cancels view caching for this module, allowing the triggering of the detached callback
  };

  LifeCycle.prototype.bindingComplete = function() {
    system.log("Lifecycle : bindingComplete : hello");
    this.list.push(this.name + ":bindingComplete:" + new Date().getTime());
  };

  LifeCycle.prototype.attached = function(view, parent) {
    system.log("Lifecycle : attached : hello");
    this.list.push(this.name + ":attached:" + new Date().getTime());
  };

  LifeCycle.prototype.compositionComplete = function(view) {
    system.log("Lifecycle : compositionComplete : hello");
    this.list.push(this.name + ":compositionComplete:" + new Date().getTime());
  };

  LifeCycle.prototype.detached = function(view) {
    system.log("Lifecycle : detached : hello");
    this.list.push(this.name + ":detached:" + new Date().getTime());
  };
  return LifeCycle;
});
